package leetcode.code2042;

public class Solution {
	public boolean areNumbersAscending(String s) {
		for (int i = 0, last = -1, num = 0; i <= s.length(); i++) {
			char cur = i < s.length() ? s.charAt(i) : ' ';
			if (cur == ' ' && num != 0) {
				if (num <= last)
					return false;
				last = num;
				num = 0;
			} else if (cur >= '0' && cur <= '9') {
				num = num * 10 + cur - '0';
			}
		}
		return true;
	}

	public static void main(String[] args) {
		Solution so = new Solution();
		so.areNumbersAscending("hello world 5 x 5");

		for (int i = 1; i < 100; i++) {
//			System.out.println(i+" " + Integer.toBinaryString(i) + " " + Integer.numberOfLeadingZeros(i));
//			System.out.println(i + " "
//					+ ((33 - Integer.numberOfLeadingZeros(i)) + " " + (Integer.toBinaryString(i).length() + 1)));

			int K = 33 - Integer.numberOfLeadingZeros(i - 1);
			int barrier = 1 << K;
			System.out.println(2 * barrier + 1);
		}
		
		
	}
}
